﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var from = $.request("from");
    var organizeId = $.request("organizeId");
    var isContansChildOrg = $.request("isContansChildOrg");
    var keyValue = $.request("keyValue");
    var isExpand = $.request("isExpand");
    var callbackType = $.request("callbackType");
    var single = $.request("single");
    var isShowEmpty = $.request("isShowEmpty");
    $(function () {
        initControl();
    })

    function initControl() {
        $("#userStaffTree").treeview({
            height: 440,
            slimscroll: false,
            showcheck: true,
            url: "/SystemManage/SysUser/GetSysUserSelectorTree",
            param: { from: from, organizeId: organizeId, isContansChildOrg: isContansChildOrg, keyValue: keyValue, isExpand: isExpand, isShowEmpty: isShowEmpty }
        });
    }

    function AcceptClick(callBack) {
        var treeSeleData;
        if (callbackType == 'json') {
            treeSeleData = $("#userStaffTree").getCheckedNodeObjArray();
            if (single == 'true' && treeSeleData.length != 1) {
                $.modalAlert('最多选中一条', 'warning');
                return;
            }
        }
        else {
            treeSeleData = $("#userStaffTree").getCheckedValues();  //Values对应的是UserId
            if (single == 'true' && treeSeleData.length != 1) {
                $.modalAlert('最多选中一条', 'warning');
                return;
            }
            treeSeleData = String(treeSeleData);
        }

        callBack(treeSeleData);
        $.modalClose();
    }
</script>
<form id="form1">
    <div class="widget-body">
        <div id="userStaffTree"></div>
    </div>
</form>


